#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 1e6 + 10;

int n, a[N], p[N], q[N];

int main() {
#ifdef YJR_2333_TEST
	freopen("1.in", "r", stdin);
#endif
	n = in; rep(i, 1, n) a[i] = in, p[i] = i;
	int tot = 0; rep(i, 1, n) tot += a[i];
	vector < vec > pot;
	if(n % 2 == 0 && tot % n && tot % (n / 2) == 0) {
		vec tpot(n + 1, 0);
		rep(i, 1, n) tpot[i] = i, a[i] += i;
		pot.eb(tpot);
	}
	else if(tot % n) return puts("No"), 0;
	auto out = [&]() {
		printf("Yes\n%d\n", pot.size());
		for(auto v : pot) {
			rep(i, 1, n) printf("%d ", v[i]);
			puts("");
		} exit(0);
	};
	rep(x, 1, 10000) {
		sort(p + 1, p + n + 1, [&](int x, int y) { return a[x] > a[y]; });
		int p1 = 1, p2 = n;
		rep(i, 1, n) q[i] = p[i & 1 ? p1 ++ : p2 --];
		if(a[q[1]] == a[q[2]]) out();
		vec tpot(n + 1, 0);
		rep(i, 1, n) tpot[q[i]] = i;
		rep(i, 1, n) a[i] += tpot[i];
		pot.eb(tpot);
		rep(i, 1, n) tpot[q[i]] = n - i + 1;
		rep(i, 2, n) {
			if(a[q[i]] + 1 <= a[q[i - 1]]) swap(tpot[q[i]], tpot[q[i - 1]]);
			i++; 
		}
		rep(i, 1, n) a[i] += tpot[i];
		pot.eb(tpot);
	} puts("No");
	return 0;
}
